// 导入数据库连接对象
const db = require("../db");
// 导入配置信息
const { debug, info } = require("../config");

/**
 * 获取最热文章
 */
exports.getArticles = async (req, res) => {
  // 操作数据库
  let sql = `select id, article_title as title,article_createdTime as time, article_content, article_views as views from blog_article where article_deletedTime is Null order by views desc`;
  const data = await db.promise().query(sql);
  // console.log(data);
  res.send({
    code: 0,
    message: "获取所有用户成功",
    result: {
      data,
    },
  });
};
